# -*- coding: utf-8 -*-
import urllib2
import bs4


def main():
	url = "http://www.yhdm.io/top/"
	data = urllib2.urlopen(url).read()
	soup = bs4.BeautifulSoup(data,'html5lib')

	from yhdm import main as runner
	for li in soup.select('.topli')[0].select('li'):
		name1 = li.find('a').getText()
		print '-------------------- start fetch :', name1, type(name1)
		try:
			runner(name1.encode('utf-8'))
		except Exception:
			print 'runner error: ', name1


if __name__ == "__main__":
	main()
